<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>系统首页</title>
  <link rel="stylesheet" href="/layui/css/layui.css">
  <link rel="stylesheet" href="{$CSS}/bootstrap3.3.7.min.css">
  <style>
    em {
      font-size: 20px;
      color: red;
      vertical-align: middle;
      line-height: 20px;
      height: 20px;
      display: inline-block;
    }

    .mar {
      margin-right: 10px
    }

    .pic {
      float: none;
      margin-bottom: 10px
    }

    .pic img {
      width: 100px;
      height: 100px;
    }
  </style>
</head>
<body style="overflow-x:hidden;">
<div style="padding:10px;border-bottom:1px solid #eee;font-size:15px;font-weight:700">点大商城总配置</div>
<div style="margin:40px auto;">
  <div class="bs-example" data-example-id="simple-horizontal-form">
    <form class="form-horizontal" method="post" action="" name="clientForm" id="clientForm" onsubmit="">{tk()}{$c->hidden('id')}
      <div class="form-group">
        <!-- <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>状态：</label>
        <div class="col-sm-3">
          {$c->checkbox('oss_status')}
          <label>开启OSS存储</label>
        </div>
      </div> -->
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>主机地址：</label>
        <div class="col-sm-3">
          {$c->password('database_ip','class="form-control"')}
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>数据库：</label>
        <div class="col-sm-3">
          {$c->password('database_name','class="form-control"')}
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>账户名：</label>
        <div class="col-sm-3">
          {$c->password('user_name','class="form-control" placeholder=""')}
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>密码：</label>
        <div class="col-sm-3">
          {$c->password('database_pas','class="form-control" placeholder=""')}
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>端口号：</label>
        <div class="col-sm-3">
          {$c->text('port','class="form-control" placeholder=""')}
        </div>
      </div>

      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"><em>*</em>自定义标题：</label>
        <div class="col-sm-3">
          {$c->text('self_title','class="form-control" placeholder=""')}
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label"></label>
        <div class="col-sm-6">
          <input class="btn btn-success mar" type="hidden" name="action" value="add"/>
          <input class="btn btn-success mar" name="btnAdd" ID="btnAdd" type="submit" value="保存">
          <input class="btn btn-warning mar" name="reset" ID="Submit1" type="reset" value="重置">
          <input class="btn btn-danger mar" name="back" ID="back" type="button" onclick="history.back();" value="返回">
          <span class="layui-btn layui-btn  layui-btn-normal" onclick="ceshi()">测试连接</span>
        </div>
      </div>

    </form>
  </div>

</div>
<script src="/cdn/jquery.js"></script>
<script src="/layui/layui.all.js"></script>
<script type="text/javascript">
  function  ceshi(){ 
    let database_ip = $("#sc_point_confingdatabase_ip").val();
    if(!database_ip) return layer.msg('请填写主机地址');
    let user_name = $("#sc_point_confinguser_name").val();
    if(!user_name) return layer.msg('请填写用户名');
    let database_name = $("#sc_point_confingdatabase_name").val();
    if(!database_name) return layer.msg('请填写数据库名');
    let database_pas = $("#sc_point_confingdatabase_pas").val();
    if(!database_pas) return layer.msg('请填写密码');
    let port = $("#sc_point_confingport").val();
    if(!port) return layer.msg('请填写端口号');
    ajax('pointbigshop-ceshi.html',{ database_ip:database_ip,user_name:user_name,database_name:database_name,database_pas:database_pas,database_pas:database_pas,port:port},function(res){
      res = JSON.parse(res);
      if(res.status == 'success'){
        layer.msg('连接成功',!{icon: 1})
      }else{
       layer.msg('连接失败',!{icon: 5});
      }
    });
  } 
</script>
</body>

</html>